package com.daocao.jy.fragment;

import android.os.Bundle;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.LinearLayout;

import com.daocao.jy.R;
import com.daocao.jy.adapter.FragmentMyInviteAdapter;

import java.util.ArrayList;
import java.util.List;

import butterknife.BindView;
import butterknife.ButterKnife;
import butterknife.Unbinder;

/**
 * Created by xsooy-pc on 18-4-19.
 */

public class MyInviteFragment extends BaseFragment {
    @BindView(R.id.list)
    RecyclerView list;
    @BindView(R.id.layout_empty)
    LinearLayout layoutEmpty;
    Unbinder unbinder;
    private FragmentMyInviteAdapter adapter;

    @Override
    protected int setLayoutId() {
        return R.layout.fragment_invite_my;
    }

    @Override
    protected void initView() {
        LinearLayoutManager layoutManager = new LinearLayoutManager(getContext());
        layoutManager.setSmoothScrollbarEnabled(true);
        layoutManager.setAutoMeasureEnabled(true);

        list.setLayoutManager(layoutManager);
        list.setHasFixedSize(true);
//        list.setNestedScrollingEnabled(false);
        adapter = new FragmentMyInviteAdapter(getContext());
        list.setAdapter(adapter);
        List<String> data = new ArrayList<>();
        data.add("dadsa");
        data.add("dadsa");
        data.add("dadsa");
        data.add("dadsa");
        data.add("dadsa");
        data.add("dadsa");
        adapter.update(data);
    }

    @Override
    public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
        // TODO: inflate a fragment view
        View rootView = super.onCreateView(inflater, container, savedInstanceState);
        unbinder = ButterKnife.bind(this, rootView);
        return rootView;
    }

    @Override
    public void onDestroyView() {
        super.onDestroyView();
        unbinder.unbind();
    }
}
